package com.lenovo.agricultureServer.bean;

import java.util.ArrayList;

public class Sensor extends Component
{
	public static final String PM25_SENSOR = "SmokeSensor";	//PM2.5浓度传感器
	public static final String CO2_SENSOR = "CO2Sensor";	//CO2浓度传感器
	
	public static final String AIR_TMPER_SENSOR = "TmperSensor";	//空气温度传感器
	public static final String AIR_HUMID_SENSOR = "HumidSensor";	//空气湿度传感器
	public static final String SOIL_TMPER_SENSOR = "SoilTSensor";	//土壤温度传感器
	public static final String SOIL_HUMID_SENSOR = "SoilHSensor";	//土壤湿度传感器
	public static final String LIGHT_SENSOR = "lightSensor";	//灯光强度传感器
	
	private int value = -1; //传感器的数据值,默认为－1
	
	public Sensor(String name,int subDev)
	{
		super(name, subDev);
	}
	
	public int getValue() {
		return value;
	}
	public void setValue(int value) {
		this.value = value;
	}
	
	public static Sensor getSensorByName(ArrayList<Sensor> sensorList, String name)
	{
		Sensor ret = null;
		if(sensorList!=null && name!=null)
		{
			for(Sensor sensor : sensorList)
			{
				if(name.equals(sensor.getName()))
				{
					ret = sensor;
					break;
				}
			}
		}
		return ret;
	}
}
